package com.ddf.jpa.boot;

import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.boot.autoconfigure.domain.EntityScan;
import org.springframework.context.annotation.ComponentScan;
import org.springframework.data.jpa.repository.config.EnableJpaAuditing;
import org.springframework.data.jpa.repository.config.EnableJpaRepositories;
import org.springframework.data.web.config.EnableSpringDataWebSupport;
import org.springframework.transaction.annotation.EnableTransactionManagement;

/**
 * @EnableJpaRepositories 开启JpaRepository接口的支持
 * @EnableTransactionManagement 开启注解版事务支持
 * @EnableJpaAuditing 开启对@CreteBy, @CreateTime, @LastModifiedDate等注解的支持
 * @EnableSpringDataWebSupport 开启JPA对WEB模块提供的一些组件支持，如解析分页来入参Pageable pageable
 *  https://docs.spring.io/spring-data/jpa/docs/2.0.10.RELEASE/reference/html/#core.web.basic
 * @EntityScan 指定实体类的扫描包路径
 */

@SpringBootApplication
@EnableJpaRepositories(basePackages = {"com.ddf.jpa.boot.repository"})
@ComponentScan("com.ddf")
@EnableTransactionManagement
@EnableJpaAuditing
@EnableSpringDataWebSupport
@EntityScan(basePackages = "com.ddf.jpa")
public class SpringDataJpaApplication {

    public static void main(String[] args) {
        SpringApplication.run(SpringDataJpaApplication.class, args);
    }
}
